package cn.stylefeng.guns.modular.pageConfig.controller;

import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
import cn.stylefeng.guns.modular.pageConfig.entity.PageConfig;
import cn.stylefeng.guns.modular.pageConfig.model.params.PageConfigParam;
import cn.stylefeng.guns.modular.pageConfig.service.PageConfigService;
import cn.stylefeng.roses.core.base.controller.BaseController;
import cn.stylefeng.roses.kernel.model.response.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


/**
 * 站点配置控制器
 *
 * @author Dong
 * @Date 2023-08-11 13:42:54
 */
@Controller
@RequestMapping("/pageConfig")
public class PageConfigController extends BaseController {

    private String PREFIX = "/pageConfig";

    @Autowired
    private PageConfigService pageConfigService;

    /**
     * 跳转到主页面
     *
     * @author Dong
     * @Date 2023-08-11
     */
    @RequestMapping("")
    public String index() {
    	return PREFIX + "/pageConfig_edit.html";
    }


    /**
     * 编辑接口
     *
     * @author Dong
     * @Date 2023-08-11
     */
    @RequestMapping("/editItem")
    @ResponseBody
    public ResponseData editItem(PageConfigParam pageConfigParam) {
        this.pageConfigService.update(pageConfigParam);
        return ResponseData.success();
    }

    /**
     * 查看详情接口
     *
     * @author Dong
     * @Date 2023-08-11
     */
    @RequestMapping("/detail")
    @ResponseBody
    public ResponseData detail(PageConfigParam pageConfigParam) {
        PageConfig detail = this.pageConfigService.getById(1);
        return ResponseData.success(detail);
    }

}


